<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DOHN</title>
<link href="../html/css/style.css" rel="stylesheet" type="text/css" />
<link href="../html/css/table.css" rel="stylesheet" type="text/css" />
<link href="../html/css/popup1.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#left {
	background:#fff;
}

</style>
<script language="JavaScript" src="../html/DropCalendar.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
    function open_window(addr) {
        newwin = window.open(addr, "DOHN","location=0,status=0,scrollbars=1,menubar=0,directories=0,resizable=1,top=300,left=200,width=780,height=260");
    }
function isValidDate(v) {

	var tmp = v.split('-');
	var syear = tmp[0];
	var smonth = tmp[1];
	var sday = tmp[2];
	var temp, year, month, day;
	var days = new Array (31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

    if(syear.length != 4 || smonth.length!=2 || sday.length!=2 ){
	alert(syear.toString());
		return false;
	}
    year = parseInt(syear);

	temp = smonth;
    if(temp.charAt(0) == '0')
        temp = temp.charAt(1);
    month = parseInt(temp);

    temp = sday;
    if(temp.charAt(0) == '0')
        temp = temp.charAt(1);
    day = parseInt(temp);

	if(year%4==0 && year%100 !=0 || year%400==0)
		days[1]=29;
	else
		days[1]=28;

	if(month < 1 || month > 12)
		return false;

	if(day > days[month-1] || day < 1)
		return false;
	return true;

}

 function check_format(v){

  var tmp=v.split('-');
  if(tmp.length!=3 || tmp[0].length!=4 || tmp[1].length!=2 || tmp[2].length!=2){
   alert('Inappropriate format for date. Please input YYYY-MM-DD');
   return false;
  }
  else if(isNaN(tmp[0])||isNaN(tmp[1])||isNaN(tmp[2])){
	alert('Please input YYYY-MM-DD in a number');
	return false;
  }
  else {
   return true;
	}

 }

 function s_submit()
 {
   if(check_format(document.calendar.date1.value) == false){
    document.calendar.date1.focus();
	return false;
  }
    if(isValidDate(document.calendar.date1.value) == false){
  alert('Please input correct date');
    document.s_join.date.focus();
	return false;
  }
     if(check_format(document.calendar.date2.value) == false){
    document.calendar.date2.focus();
	return false;
  }
    if(isValidDate(document.calendar.date2.value) == false){
  alert('Please input correct date');
    document.calendar.date2.focus();
	return false;
  }
  document.calendar.submit();
 }
//-->
</SCRIPT>

</head>
<body>
<!---MSG!--->
<div id="container">
    <div id="nav">

        <div id="header">
            <a href="index"><img src="../html/images/logo.jpg" border=0></a>
            <div id="admin_menu">
                <a href="admin">Admin</a>
                <a href="sign_out">Sign-Out</a>
            </div>
        </div>

        <ul>
            <li ><a href="index"><span>Home</span></a></li>
            <li class="active"><a href="transaction"><span>Transaction</span></a></li>
            <li ><a href="shortcut"><span>Shortcut</span></a></li>
            <li ><a href="report"><span>Report</span></a></li>
            <li ><a href="mypage"><span>My page</span></a></li>
        </ul>

    </div>
</div>
<!--- 여기부터 컨텐츠 들어갑니다 !-->
<div id="main">
	<div id="main_detail" >
        <div id="left">
            <div id="calander">
                <form id="calander" name="calendar" action="transaction_date" method="post">
                    <br>
                    Start :<input id="date1"  type="text" name="date1"  maxlength="10" value="<!---DATE1!--->
					<INPUT id="Button1" style="WIDTH: 30px; HEIGHT: 24px" onclick="javascript:OpenCal('date1');" type="button" value="Cal" name="Button1">
                    <br>
                    <center>~	</center>
                    End :<input id="date2"  type="text" name="date2"  maxlength="10" value="<!---DATE2!--->
					<INPUT id="Button2" style="WIDTH: 30px; HEIGHT: 24px" onclick="javascript:OpenCal('date2');" type="button" value="Cal" name="Button2">
                    <br>
                    <input type="button" value="Search" onClick="s_submit();" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/button.jpg); margin: 6px 0  0 78px;" onclick="javascript:location.href = '#';"/>
                </form>
            </div>

            <div id="help">
                <form id="search" action="transaction_keyword" method="post">
                    <strong>Search</strong> transactions <br>with <strong>keywords</strong>
                    <input id="search" type="text" name="input_word" />
                    <input type="submit" value="Search" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/button.jpg); margin: 8px 0  0 85px;" onclick="javascript:location.href = '#';"/>
                </form>
            </div>
        </div>

        <div id="right">
            <h2>TransactionTopTitle</h2>
            <div id="add_import">
                <input type="button" value="Add" onclick="open_window('transaction_add')" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/button.jpg) ;">
                <input type="button" value="Import" onclick="open_window('import_file')" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/button.jpg) ;">
                <!---
                <form action="#" method="post">
                    <input type="submit" value="Add" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/submit_btn.jpg) ;" onclick="javascript:location.href = 'transaction_add';"/>
                    <input type="submit" value="Import" style="width:80px; height:27px; color:#fff; border:none; background: url(../html/images/submit_btn.jpg) ;" onclick="javascript:location.href = '#';"/>
                </form>
                !--->
            </div>
            <table id="basic" style="width:700px; margin-top:15px;">
                <thead>
                    <tr>
                        <th scope="col">Date</th>
                        <th scope="col">Description</th>
                        <th scope="col">Amount</th>
                        <th scope="col">Balance</th>
                        <th scope="col">Category</th>
                        <th scope="col" colspan=2>Modify</th>
                    </tr>
                </thead>
                <tbody>
                <!---
                    <tr>
                        <td>Date1</td>
                        <td>Description1</td>
                        <td>Amount1</td>
                        <td>Balance1</td>
                        <td>Category1</td>
                        <td style="width:5%">Edit</td>
                        <td style="width:5%">Del</td>
                    </tr>
                        <tr class="odd">
                        <td>Date1</td>
                        <td>Description1</td>
                        <td>Amount1</td>
                        <td>Balance1</td>
                        <td>Category1</td>
                        <td>Edit</td>
                        <td>Del</td>
                    </tr>
                !--->
<!---CONTENT!--->
                </tbody>
            </table>
        </div><!---div right !--->

	</div><!---div main_detail !--->
</div><!---div main !--->

<div class="clear"></div>

</div>
<div id="footer">
    <div id="footerContainer">
    </div>
</div>

</body>
</html>
